package cc.lj.internal.merchant.interfaces.facade;

import cc.lj.internal.api.merchant.dto.PropertyRelatonApiDTO;
import cc.lj.internal.api.merchant.query.PropertyRelationApiQuery;
import cc.lj.internal.merchant.domain.contract.model.vo.PropertyRelationDO;
import cc.lj.internal.merchant.domain.contract.service.IPropertyRelationDomainService;
import cc.lj.internal.merchant.interfaces.dto.convert.PropertyRelatioonDTOConvertDO;
import cc.lj.internal.merchant.interfaces.dto.query.PropertyRelationQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 物业资源分类接口信息
 * @author zhaoyong
 * @date 2021-12-23
 */

@RestController
@RequestMapping("/propertyRelation")
@Api(tags = "物业资源分类信息接口")
@Slf4j
@Validated
public class PropertyRelationController {

    @Autowired
    private IPropertyRelationDomainService domainService;

    @PostMapping("/showAreaList")
    @ApiOperation(value = "展位区域列表接口",notes = "")
    public List<PropertyRelatonApiDTO> showAreaList(@RequestBody PropertyRelationApiQuery propertyRelationQuery)
    {
        List<PropertyRelationDO> list = domainService.getList(PropertyRelatioonDTOConvertDO.INSTANCE.convert(propertyRelationQuery));
        List<PropertyRelatonApiDTO> r_list = list.stream().map(t -> PropertyRelatioonDTOConvertDO.INSTANCE.convert(t)).collect(Collectors.toList());
        return r_list;
    }

}
